-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-35014] SqlNode to operation conversion for models #25834
base: master
Are you sure you want to change the base?
Conversation
cc @twalthr to review. Thanks! |
|
flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl
Outdated
Show resolved
Hide resolved
Reviewed by Chi on 09/01/2025 Go back to the submitter with review comments. |
.../src/test/java/org/apache/flink/table/planner/operations/SqlDdlToOperationConverterTest.java
Outdated
Show resolved
Hide resolved
...table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelReset.java
Outdated
Show resolved
Hide resolved
...k-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelSet.java
Outdated
Show resolved
Hide resolved
...able/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelRename.java
Outdated
Show resolved
Hide resolved
flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModel.java
Outdated
Show resolved
Hide resolved
92fa1f1
to
b871658
Compare
@snuyanzin , thanks for the review. Addressed your comments |
.../src/test/java/org/apache/flink/table/planner/operations/SqlDdlToOperationConverterTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/flink/table/planner/operations/SqlDdlToOperationConverterTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/flink/table/planner/operations/SqlDdlToOperationConverterTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/flink/table/planner/operations/SqlDdlToOperationConverterTest.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/flink/table/planner/operations/SqlNodeToOperationConversion.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/flink/table/planner/operations/SqlNodeToOperationConversion.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/flink/table/planner/operations/SqlNodeToOperationConversion.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/flink/table/planner/operations/SqlNodeToOperationConversion.java
Outdated
Show resolved
Hide resolved
...k-table-api-java/src/main/java/org/apache/flink/table/operations/DescribeModelOperation.java
Outdated
Show resolved
Hide resolved
@flinkbot run azure |
@flinkbot run azure re-run the last Azure build |
@flinkbot run azure |
Looks the CI run is always posted in #25834 (comment) |
...able/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelRename.java
Outdated
Show resolved
Hide resolved
...table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelReset.java
Outdated
Show resolved
Hide resolved
...k-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelSet.java
Outdated
Show resolved
Hide resolved
ResolvedCatalogModel resolvedModel = | ||
newModel == null ? null : resolveCatalogModel(newModel); | ||
catalog.alterModel(path, resolvedModel, modelChanges, ignoreIfNotExists); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is a reason to pass non-existing model as a null
further rather than applying similar behavior as for alterTable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In altertable
call, if the table doesn't exist, the operation is a NopOperation
: https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/SqlNodeToOperationConversion.java#L409. This leads to problem where we don't know the original sql operation and properly give error message etc. So in alterModel
it's still altermodelOperation
and null indicates original model doesn't exist. It can be handled by downstream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot simply pass nulls if this is not documented in the Catalog JavaDoc. Why should we allow alter model if it doesn't exist? The catalog manager or higher layers can deal with the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made it unresolved again since the problem is not solved yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Handle non exist model in AlterModelChangeOperation#execute()
method
...k-table-api-java/src/main/java/org/apache/flink/table/operations/DescribeModelOperation.java
Show resolved
Hide resolved
.../java/org/apache/flink/table/planner/operations/converters/SqlAlterModelRenameConverter.java
Outdated
Show resolved
Hide resolved
...ain/java/org/apache/flink/table/planner/operations/converters/SqlAlterModelSetConverter.java
Outdated
Show resolved
Hide resolved
...table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterModelReset.java
Outdated
Show resolved
Hide resolved
ResolvedCatalogModel resolvedModel = | ||
newModel == null ? null : resolveCatalogModel(newModel); | ||
catalog.alterModel(path, resolvedModel, modelChanges, ignoreIfNotExists); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot simply pass nulls if this is not documented in the Catalog JavaDoc. Why should we allow alter model if it doesn't exist? The catalog manager or higher layers can deal with the problem.
...k-table-api-java/src/main/java/org/apache/flink/table/operations/ddl/DropModelOperation.java
Outdated
Show resolved
Hide resolved
...n/java/org/apache/flink/table/planner/operations/converters/SqlAlterModelResetConverter.java
Outdated
Show resolved
Hide resolved
...n/java/org/apache/flink/table/planner/operations/converters/SqlAlterModelResetConverter.java
Outdated
Show resolved
Hide resolved
Map<String, String> changeModelOptions = | ||
OperationConverterUtils.extractProperties(sqlAlterModelSet.getOptionList()); | ||
if (changeModelOptions.isEmpty()) { | ||
throw new ValidationException("ALTER MODEL SET does not support empty option"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above:
For tables we also check for immutable connector option. Do we want to do the same for models?
.../main/java/org/apache/flink/table/planner/operations/converters/SqlCreateModelConverter.java
Outdated
Show resolved
Hide resolved
.../main/java/org/apache/flink/table/planner/operations/converters/SqlCreateModelConverter.java
Outdated
Show resolved
Hide resolved
...ble/flink-table-planner/src/test/scala/org/apache/flink/table/api/TableEnvironmentTest.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed at least one issue which should be mitigated before merge
https://github.com/apache/flink/pull/25834/files#r1973674359
What is the purpose of the change
Add
SqlNode
toSqlOperation
conversion for modelsBrief change log
Verifying this change
This change added tests and can be verified as follows:
TableEnvironmentTest
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes)Documentation